<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>hello</div>
    <p class="p1"></p>
    <div id="divs"></div>

    <div class="nav">nav1</div>
    <div class="nav">nav2</div>


    <script>
        var divs = document.getElementsByTagName('div')[0];
        divs.innerHTML = 'itbai';

        var text = document.getElementsByClassName('p1')[0];
        text.innerHTML = 'hello world';

        var root = document.getElementById('divs');
        root.innerHTML = 'itbai zhan';

        var nav =document.querySelector('.nav') //返回第一个符合条件的元素
        nav.innerHTML = 'nav111'

        var navs =document.querySelectorAll('.nav') //返回所有符合条件的元素
        navs[1].innerHTML = 'nav222'

    </script>


</body>
</html>